package com.excellent.controller;

import com.excellent.entity.ChatResponse;
import com.excellent.service.ChatService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@CrossOrigin
@RestController
@RequestMapping("/chat")
public class ChatController {

    @Autowired
    ChatService chatService;

    @RequestMapping("/getChat")
    public ChatResponse getChat(@RequestBody Map<String, String> map) {
        String appId = "0f5cb1e1-d144-4c90-b494-813e05a924cb";
        return chatService.getChat(appId, map.get("question"));
    }
}